/*
 * @Date: 2019-08-31 15:05:59
 * @Github: https://github.com/FinnWu
 * @LastEditors: Finnwu
 * @LastEditTime: 2019-08-31 15:22:06
 */


 // 变态跳台阶
function jumpFloorII(number){
    // write code here
    if (number === 1 || number === 2) {
        return number
    }
    var arr = [1, 2]
    for(var i = 3; i <= number; i++) {
        var sum = 0
        arr.forEach(item => {
            sum += item
        })
        arr.push(sum + 1)
    }
    return arr[number - 1]
}

console.log(jumpFloorII(3));

